#include<stdlib.h>
#include<string.h>
#include<tools_node.h>
#include<math.h>
#ifndef MARCHING_CUBES_H_
#define MARCHING_CUBES_H_

typedef struct {
   double p[3][3];
   double normals[3][3];
   int i ,j, k;
   void * prop;
} TRIANGLE;

typedef struct {
   double p[8][3];
   double val[8];
   double normals[8][3];
} GRIDCELL;


#ifdef __cplusplus
extern "C"{
#endif

int polygonise(GRIDCELL grid,double isolevel,TRIANGLE *triangles);

//double* marching_cubes_compute_normal(double* p,double step,double ( * fun)(double* p,void* tool),void* tool1 );


Node* marching_cubes_generate_triangles(double iso,int len_grids,double(*fun)(double* ,void*),void* tool);


Node**** marching_cubes_generate_trianglesn(double iso,int len_grids,
   double(*fun)(double* ,void*),void* tool,Node**tris1 );


#ifdef __cplusplus
}
#endif
#endif